home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snpd1292.zip / XTEST.C < prev   
C/C++ Source or Header  |  1992-12-26  |  821b  |  36 lines

  1. #include <stdio.h>
  2. #include "xfile.h"
  3.  
  4.  
  5. int main(int argc, char **argv)
  6. {
  7.       while (*++argv != 0)
  8.       {
  9.             XFILE *f = xopen(*argv);
  10.  
  11.             if (f == 0)
  12.                   fprintf(stderr, "ERROR: can't open file %s\n", *argv);
  13.             else
  14.             {
  15. #if 0
  16.                   char *s;
  17.  
  18.                   fprintf(stdout, "--- %s ---\n", *argv);
  19.                   while ((s = xgetline(f)) != 0)
  20.                         fputs(s, stdout);
  21.                   xclose(f);
  22. #else
  23.                   unsigned int nLines = 0;
  24.                   char *s;
  25.  
  26.                   while ((s = xgetline(f)) != 0)
  27.                         ++nLines;
  28.                   printf("%5u lines in %s\n", nLines, *argv);
  29.                   xclose(f);
  30. #endif
  31.             }
  32.       }
  33.  
  34.       return 0;
  35. }
  36.